/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package drinkcounter.web.vaadin;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Toni
 */
@Singleton
public class GuiceApplicationServlet extends AbstractApplicationServlet{
    
    private Provider<Application> applicationProvider;

    @Inject
    public void setApplicationProvider(Provider<Application> applicationProvider) {
        this.applicationProvider = applicationProvider;
    }

    @Override
    protected Application getNewApplication(HttpServletRequest request) throws ServletException {
        return applicationProvider.get();
    }

    @Override
    protected Class<? extends Application> getApplicationClass() throws ClassNotFoundException {
        return Application.class;
    }

}
